Ext.define('Admin.view.chart.area2d.MainViewController', {
    extend: 'Ext.app.ViewController',
    alias: 'controller.chart_area2d_mainviewcontroller',

    listen: {
        component: {
            'basefusionchart[reference=area2d]': {
                successfullyRenderd: 'area2dSuccessfullyRenderd'
            }
        }
    },

    area2dSuccessfullyRenderd: function () {
        var me = this;
        var area2d = me.lookup('area2d');
        //延迟0.2秒设置数据 模拟网络加载
        Ext.Function.defer(function () {
            area2d.setDataSource({
                chart: {
                    caption: "Yearly sales of iPhone",
                    yaxisname: "Number of units sold",
                    subcaption: "2007-2016",
                    legendposition: "Right",
                    drawanchors: "0",
                    showvalues: "0",
                    plottooltext: "<b>$dataValue</b> iPhones sold in $label",
                    theme: "fusion"
                },
                data: [
                    {
                        label: "2007",
                        value: "1380000"
                    },
                    {
                        label: "2008",
                        value: "1450000"
                    },
                    {
                        label: "2009",
                        value: "1610000"
                    },
                    {
                        label: "2010",
                        value: "1540000"
                    },
                    {
                        label: "2011",
                        value: "1480000"
                    },
                    {
                        label: "2012",
                        value: "1573000"
                    },
                    {
                        label: "2013",
                        value: "2232000"
                    },
                    {
                        label: "2014",
                        value: "2476000"
                    },
                    {
                        label: "2015",
                        value: "2832000"
                    },
                    {
                        label: "2016",
                        value: "3808000"
                    }
                ]
            });
        }, 200);
    }
});
